import os
from archive.Book import Book
from archive.Comic import Comic
from archive.FunctionSet import DetermineFunction 

class Beehive:
    """
    Comics = Comic[]
    archive_list = file & directory info []
    data_list = file & directory info []    
    """
    Comics = []
    archive_list = []
    data_list = []
    imagefileratio = 0.8
    minibookpage = 30
    minichapterpage = 5
    
    def __init__(self):
        pass
        
    def archive_append(self, path):
        self.archive_list.append((path, os.stat(path)))
        
    def rebuilding(self):
        for (path, stat) in self.archive_list:
            if os.path.exists(path):
                for item in os.listdir(path):
                    item_path = os.path.join(path, item)
                    if DetermineFunction.PathisComic(item_path):
                        self.Comics.append(Comic(item_path, stat))
            else:
                pass